import { useEffect, useState } from 'react';
import { Tag } from 'antd';

export default function YesNoIndicator({ value }) {
  const [text, setText] = useState('');
  const [color, setColor] = useState('');

  useEffect(() => {
    switch (value) {
      case true:
        setText('是');
        setColor('green');
        break;
      case false:
        setText('否');
        setColor('default');
        break;
    }
  }, [value]);

  return <Tag color={color}>{text}</Tag>;
}
